package user

import (
	"gitee.com/yanxinfire/geektime-week2-error/pkg/models"
)

func GetUser(userId int) (*GetUserResponse, error) {
	u := &models.User{Id: userId}
	outU, err := models.GetUserById(u)
	if err != nil {
		return nil, err
	}
	resp := &GetUserResponse{UserId: outU.Id, UserName: outU.Name}
	return resp, nil
}

type GetUserResponse struct {
	UserId   int    `json:"userId"`
	UserName string `json:"userName"`
}
